Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
tc-wrapper
Advanced tools
Wrapper & parser of linux tc command (traffic control).
Allow setting, consulting and deleting rules of delay, jitter, bandwidth and corruption
This module is installed via npm:
npm install --save tc-wrapper
The library export a instantiable class that has three major methods: del
, get
and set
, for deleting, fetching and setting tc rules.
Keep in mind that set
method will call del
before execute, so it will clean all the rules before aplying the new ones.
Allowed targeting
Currently tc-wrapper only supports ip traffic, and can match by network, src and dst ports.
Allowed modificators
import TCWrapper from 'tc-wrapper';
const tcWrapper = new TCWrapper('eth0');
tc.Wrapper.get().then((rules) => {
/* rules looks like:
{
"outgoing": {
"srcNetwork=0.0.0.0/0,protocol=ip": {
"delay": "1.0ms",
"jitter": "0.5%",
"loss": "3%",
"corrupt": "2%",
"rate": "10Mbit"
}
},
"incoming": {
"dstNetwork=192.168.1.1/32,protocol=ip": {
"loss": "9%",
},
"dstNetwork=192.168.1.1/32,srcNetwork=10.10.10.0/28,srcPort=80,protocol=ip": {
"rate": "100Mbit",
}
}
}
*/
});
import TCWrapper from 'tc-wrapper';
const tcWrapper = new TCWrapper('eth0');
const myRules = {
outgoing: {
'dstNetwork=0.0.0.0/0,protocol=ip':{
delay: '20ms'
}
}
};
tc.Wrapper.set(myRules).then((rules) => {
// Rules set!
});
import TCWrapper from 'tc-wrapper';
const tcWrapper = new TCWrapper('eth0');
const myRules = {
incoming: {
'srcNetwork=0.0.0.0/0,protocol=ip':{
rate: '20Mbit'
}
}
};
tc.Wrapper.set(myRules).then((rules) => {
// Rules set!
});
This module uses debug for debugging, you can enable debug messages of all modules with:
DEBUG=tc-wrapper*
Each module has custom debug label. Example:
DEBUG=tc-wrapper:TCfilterParser
Will only show debug messages about TCfilterParser module.
npm test
In case you never heard about the MIT license.
See the LICENSE file for details.
FAQs
NodeJS wrapper for tc command (traffic control on linux)
The npm package tc-wrapper receives a total of 4 weekly downloads. As such, tc-wrapper popularity was classified as not popular.
We found that tc-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.